package com.yunhai.device.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yunhai.common.dto.PaginationVo;
import com.yunhai.common.dto.Ret;
import com.yunhai.device.service.OrrOutcupAbnormalSummaryService;
import com.yunhai.model.entity.orr.OrrOutcupAbnormalSummaryEntity;
import com.yunhai.model.vo.orr.OrrOutcupAbnormalSummaryQuery;
import com.yunhai.model.vo.orr.OrrOutcupAbnormalSummaryVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/orrOutcupAbnormalSummary")
public class OrrOutcupAbnormalSummaryController {

	@Resource
	private OrrOutcupAbnormalSummaryService orrOutcupAbnormalSummaryService;


	/**
	 * 获取 OrrOutcupAbnormalSummary 分页列表
	 */
	@GetMapping("/pagination")
	public Ret getOrrOutcupAbnormalSummaryPagination(PaginationVo paginationVo, OrrOutcupAbnormalSummaryQuery orrOutcupAbnormalSummaryQuery ) throws Exception {
		IPage page = orrOutcupAbnormalSummaryService.getOrrOutcupAbnormalSummaryPagination(paginationVo, orrOutcupAbnormalSummaryQuery );
		return Ret.toPage(page);
	}


	/**
	 * 获取 OrrOutcupAbnormalSummary 所有数据
	 */
	@GetMapping("/allList")
	public Ret getOrrOutcupAbnormalSummaryAllList( OrrOutcupAbnormalSummaryQuery orrOutcupAbnormalSummaryQuery ) throws Exception {
		List<OrrOutcupAbnormalSummaryEntity> list = orrOutcupAbnormalSummaryService.getOrrOutcupAbnormalSummaryAllList( orrOutcupAbnormalSummaryQuery );
		return Ret.ok(list);
	}


	/**
	 * 获取 OrrOutcupAbnormalSummary 详情
	 */
	@GetMapping("/{id}")
	public Ret getOrrOutcupAbnormalSummaryDetailById(@PathVariable Long id) throws Exception {

	    OrrOutcupAbnormalSummaryEntity orrOutcupAbnormalSummaryEntity = orrOutcupAbnormalSummaryService.getOrrOutcupAbnormalSummaryDetail(id);
		return Ret.ok(orrOutcupAbnormalSummaryEntity);
	}


	/**
	 * 新增 OrrOutcupAbnormalSummary
	 * */
	@PostMapping("")
	public Ret addOrrOutcupAbnormalSummary(@RequestBody OrrOutcupAbnormalSummaryVo orrOutcupAbnormalSummaryVo) throws Exception {

		orrOutcupAbnormalSummaryService.addOrrOutcupAbnormalSummary(orrOutcupAbnormalSummaryVo);
		return Ret.ok();
	}


	/**
	 * 更新 OrrOutcupAbnormalSummary
	 * */
	@PutMapping("")
	public Ret updateOrrOutcupAbnormalSummary(@RequestBody OrrOutcupAbnormalSummaryVo orrOutcupAbnormalSummaryVo) throws Exception {

		orrOutcupAbnormalSummaryService.updateOrrOutcupAbnormalSummary(orrOutcupAbnormalSummaryVo);
		return Ret.ok();
	}


	/**
	 * 删除 OrrOutcupAbnormalSummary
	 * */
	@PostMapping("/batchRemove")
	public Ret batchRemoveOrrOutcupAbnormalSummary( @RequestBody List<Long> ids ) throws Exception {

	    orrOutcupAbnormalSummaryService.batchRemoveOrrOutcupAbnormalSummary(ids);
		return Ret.ok();
	}
}
